package com.linkedin.dagli.annotation.visitor;

import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;


/**
 * {@link Visitor} annotates a <i>package</i> (this can be done in a package-info.java file), specifying options for
 * a visitor defined in that package.  To specify which classes should be visitable by the visitor, use the
 * {@link VisitedBy} annotation.  If no {@link VisitedBy} annotations are used to define at least one visitable class,
 * no visitor class will be generated (the {@link Visitor} annotation will not in itself cause a visitor class to be
 * generated).
 *
 * If a {@link Visitor} annotation is not used to configure a to-be-generated visitor, the visitor will use the default
 * options.
 */
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.PACKAGE})
@Repeatable(Visitors.class)
public @interface Visitor {
  /**
   * @return the (unqualified) name of the to-be-generated visitor class, for example, "SomeVisitor".  This must be
   *         a visitor that will be generated by {@link VisitedBy} annotations within this class.
   */
  String name();

  /**
   * @return whether or not the to-be-generated visitor class should have public or package-private accessibility.  The
   *         default value is true, meaning the visitor will be created with public visibility.
   */
  boolean isPublic() default true;
}
